<!--
 * @Author       : 刘洋 liuy5335@163.com
 * @Date         : 2025-01-25 10:58:34
 * @LastEditors  : 刘洋 liuy5335@163.com
 * @LastEditTime : 2025-02-13 08:49:13
 * @FilePath     : \zhly-vform\src\components\form-designer\setting-panel\property-editor\required-editor.vue
 * @Description  : 介绍文件的作用
 * 
 * Copyright (c) 2025 by zhlx - liuy5335@163.com, All Rights Reserved. 
-->
<template>
  <el-form-item :label="i18nt('designer.setting.required')">
    <el-switch v-model="optionModel.required" @change="handleChangeEvent"></el-switch>
  </el-form-item>
</template>

<script>
  import i18n from "@/utils/i18n"

  export default {
    name: "required-editor",
    mixins: [i18n],
    props: {
      designer: Object,
      selectedWidget: Object,
      optionModel: Object,
    },
    methods: {
      handleChangeEvent(val) {
        const wId = this.designer.selectedId
        const wName = this.designer.selectedWidgetName
        const wRef = this.designer.formWidget.getWidgetRefById(wId, wName)
        if (wRef && wRef.setRequired) {
          wRef.setRequired(val)
        }
      },

    }
  }
</script>

<style scoped>

</style>
